import Vue from 'vue'
import VueRouter from 'vue-router'
import layout from '@/layout/Index'
Vue.use(VueRouter)



export const constantRoutes = [
  {
    path: '/',
    visible: false,
    redirect:'/login'
  },
  //    登录
  {
    path:'/login',
    name:'login',
    visible: true,
    meta: {
      title: '登录',
      icon: 'mdi-fingerprint',
      keepAlive: false,
      requiresAuth:false
    },
    component:()=>import('@/views/login/Index')
  },
]

export const DynamicRoutes=[
  //  首页
  {
    path: '/home',
    visible: true,
    component: layout,
    meta: {
      title: '首页',
      icon: 'mdi-gauge',
      keepAlive: false,
      requiresAuth:true
    },
    children: [
      {
        path: '',
        name: 'home',
        meta: {
          title: '首页',
          icon: 'mdi-gauge',
          keepAlive: false,
          requiresAuth:true
        },
        component:()=>import('@/views/home/Index')
      },
    ]
  },
//    测试
  {
    path: '/test',
    visible: true,
    redirect: '/test/index',
    component: layout,
    meta: {
      title: '测试',
      icon: 'mdi-view-comfy',
      keepAlive: false,
      requiresAuth:true
    },
    children:[
      {
        path: 'index',
        name: 'testIndex',
        meta: {
          title: '测试首页',
          icon: 'mdi-alpha-w',
          keepAlive: false,
          requiresAuth:true
        },
        component: () => import('@/views/test/Index')
      },
      {
        path: 'hello',
        name: 'testHello',
        meta: {
          title: 'hello',
          icon: 'mdi-alpha-w',
          keepAlive: false,
          requiresAuth:true
        },
        component: () => import('@/views/test/hello')
      },
    ]
  },
]


const router = new VueRouter({
  mode:'history',
  routes:constantRoutes
})

export default router
